import request from "../../services/index"
import { IResponse, ListResponse } from "../../types/common"
import { UserInfoParam, ListParams, User, UserLikeParams } from "../../types/user"
// 用户基本api


// 获取用户信息
export async function getUserInfoApi(params: UserInfoParam) {
    return request.get<IResponse<User>>('/api/user/info', params);
}
// 用户列表
export async function getUserListApi(params: ListParams) {
    return request.get<IResponse<ListResponse>>('/api/user/list', params);
}

// 修改用户信息
export async function updateUserInfoApi(params: User) {
    return request.post<IResponse<string>>('/api/user/update', params);
}

// 上传用户头像
export async function uploadUserAvatarApi(file: FormData): Promise<any> {
    return request.upload('/api/user/upload-avatar', file);
}
// 根据关键词查询用户列表
export async function getUserListByKeywordApi(params: UserLikeParams) {
    return request.get<IResponse<ListResponse>>('/api/user/search', params);
}